<!DOCTYPE html>



  


<html class="theme-next pisces use-motion" lang="zh-Hans">
<head><meta name="generator" content="Hexo 3.8.0">
  <meta charset="UTF-8">
<!-- modify by zhangwei -->
<!-- 百度站长 -->
<meta name="baidu-site-verification" content="MdPKZBgY0U">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform">
<meta http-equiv="Cache-Control" content="no-siteapp">



  <meta name="google-site-verification" content="8DKRuNxJDPU2k6cNyVhLe_eSqGk-R8oiYk8iKMg5gwI">














  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css">







<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css">

<link href="/css/main.css?v=5.1.4" rel="stylesheet" type="text/css">


  <link rel="apple-touch-icon" sizes="180x180" href="/uploads/favicon.ico?v=5.1.4">


  <link rel="icon" type="image/png" sizes="32x32" href="/uploads/favicon.ico?v=5.1.4">


  <link rel="icon" type="image/png" sizes="16x16" href="/uploads/favicon.ico?v=5.1.4">


  <link rel="mask-icon" href="/uploads/favicon.ico?v=5.1.4" color="#222">





  <meta name="keywords" content="Android,layer-list,">





  <link rel="alternate" href="/atom.xml" title="班德尔城" type="application/atom+xml">






<meta name="description" content="layer-list可以将多个drawable按照顺序层叠在一起显示，默认情况下，所有的item中的drawable都会自动根据它附上view的大小而进行缩放，layer-list中的item是按照顺序从下往上叠加的，即先定义的item在下面，后面的依次往上面叠放。">
<meta name="keywords" content="Android,layer-list">
<meta property="og:type" content="article">
<meta property="og:title" content="Android青铜篇-layer-list">
<meta property="og:url" content="https://tiimor.cn/Android青铜篇-layer-list/index.html">
<meta property="og:site_name" content="班德尔城">
<meta property="og:description" content="layer-list可以将多个drawable按照顺序层叠在一起显示，默认情况下，所有的item中的drawable都会自动根据它附上view的大小而进行缩放，layer-list中的item是按照顺序从下往上叠加的，即先定义的item在下面，后面的依次往上面叠放。">
<meta property="og:locale" content="zh-Hans">
<meta property="og:image" content="http://cdn.tiimor.cn/images/%E5%94%AF%E7%BE%8E%E7%AF%87%EF%BC%8D%E4%BC%91%E6%81%AF%E5%A5%BD%EF%BC%8C%E6%98%AF%E4%B8%BA%E4%BA%86%E6%98%8E%E5%A4%A9%E6%9B%B4%E5%A5%BD%E7%9A%84%E5%AD%A6%E4%B9%A0.jpg">
<meta property="og:image" content="http://cdn.tiimor.cn/images/shape-layer-list.png">
<meta property="og:image" content="http://cdn.tiimor.cn/images/layer-list%E4%B8%89%E9%9D%A2%E8%BE%B9%E6%A1%86.png">
<meta property="og:image" content="http://cdn.tiimor.cn/images/layer-list%E9%98%B4%E5%BD%B1.png">
<meta property="og:updated_time" content="2019-03-17T06:47:42.371Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Android青铜篇-layer-list">
<meta name="twitter:description" content="layer-list可以将多个drawable按照顺序层叠在一起显示，默认情况下，所有的item中的drawable都会自动根据它附上view的大小而进行缩放，layer-list中的item是按照顺序从下往上叠加的，即先定义的item在下面，后面的依次往上面叠放。">
<meta name="twitter:image" content="http://cdn.tiimor.cn/images/%E5%94%AF%E7%BE%8E%E7%AF%87%EF%BC%8D%E4%BC%91%E6%81%AF%E5%A5%BD%EF%BC%8C%E6%98%AF%E4%B8%BA%E4%BA%86%E6%98%8E%E5%A4%A9%E6%9B%B4%E5%A5%BD%E7%9A%84%E5%AD%A6%E4%B9%A0.jpg">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Pisces',
    version: '5.1.4',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":true,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '3AUIZWGETM',
      apiKey: '5fcd6d51d892fffe3480c5b37f5fd4fa',
      indexName: 'Tiimor',
      hits: {"per_page":8},
      labels: {"input_placeholder":"搜索","hits_empty":"未发现与「${query}」相关的内容","hits_stats":"${hits} 条相关条目，使用了 ${time} 毫秒"}
    }
  };
</script>



  <link rel="canonical" href="https://tiimor.cn/Android青铜篇-layer-list/">





  <title>Android青铜篇-layer-list | 班德尔城</title>
  




<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
            (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
          m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
  ga('create', 'UA-96457043-1', 'auto');
  ga('send', 'pageview');
</script>


  <script type="text/javascript">
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?abb97f8f68c9e5eb2217d3111c64e696";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>




</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

  <!-- modify by zhangwei -->
  <!-- 下雪的动画 -->
  <div class="canvas-snow">
    <canvas id="canvas" style="margin: 0;  padding: 0;top:0; left: 0; right: 0; background: transparent; position: absolute;" width="1366" height="105"></canvas>
      <script>

      var canvasBgImg = {
        start: function () {
          this.canvas = document.getElementById('canvas')
          this.ctx = this.canvas.getContext("2d")
          this.canvas.width = window.innerWidth
          this.canvas.height = 105
          this.starList = []
        },
        drawLine: function (ctx, x1, y1, x2, y2) {
          ctx.beginPath()
          ctx.strokeStyle = '#ffffff'
          ctx.lineTo(x1, y1)
          ctx.lineTo(x2, y2)
          ctx.stroke()
        },
        canvasSingleSnow: function (snowSize) {
          var singleSnow = document.createElement('canvas'),
            ctxSingle = singleSnow.getContext('2d')
          singleSnow.setAttribute('width', snowSize * 2)
          singleSnow.setAttribute('height', snowSize * 2)
          for (var i = 0; i < 6; i++) {
            ctxSingle.save()
            ctxSingle.translate(snowSize, snowSize)
            ctxSingle.rotate(Math.PI * 2 * i / 6)
            this.drawLine(ctxSingle, 0, 0, snowSize, 0)
            ctxSingle.restore()
          }
          return singleSnow
        },
        canvasAllSnow: function (centerSnow) {
          var canvasSnow = document.createElement('canvas'),
            ctxSnow = canvasSnow.getContext('2d'),
            bigSnow = this.canvasSingleSnow(centerSnow),
            smallSnow = this.canvasSingleSnow(centerSnow / 3),
            sizeSnow = centerSnow * 3 / 5,
            rSnow = centerSnow - sizeSnow / 2
          canvasSnow.setAttribute('width', centerSnow * 2)
          canvasSnow.setAttribute('height', centerSnow * 2)
          ctxSnow.drawImage(bigSnow, 0, 0, bigSnow.width, bigSnow.height, 0, 0, centerSnow * 2, centerSnow * 2)
          for (var i = 0; i < 6; i++) {
            ctxSnow.save()
            ctxSnow.translate(centerSnow, centerSnow)
            ctxSnow.rotate(Math.PI * 2 * i / 6)
            ctxSnow.drawImage(smallSnow, 0, 0, smallSnow.width, smallSnow.height, rSnow - sizeSnow / 2,
              -sizeSnow / 2, sizeSnow, sizeSnow)
            ctxSnow.restore()
          }
          return canvasSnow
        },
        init: function () {
          this.start()
          for (var i = 0; i < 75; i++) {
            this.starList.push({
              drawFunc: this.canvasAllSnow(15),
              width: Math.random() * this.canvas.width,
              height: Math.random() * this.canvas.height,
              speed: Math.random() * 1.5 + .5,
              scale: Math.random() * 12 + 5,
              angel: 0
            })
          }
          var self = this,
            loop = function () {
              self.ctx.clearRect(0, 0, self.canvas.width, self.canvas.width)
              for (var i = 0; i < 75; i++) {
                self.ctx.save()
                self.starList[i].height = self.starList[i].height + self.starList[i].speed
                self.starList[i].angel += 2
                self.ctx.translate(self.starList[i].width, self.starList[i].height)
                self.ctx.rotate(self.starList[i].angel * Math.PI / 360)
                self.ctx.translate(-self.starList[i].width, -self.starList[i].height)
                self.ctx.drawImage(self.starList[i].drawFunc, 0, 0,
                  self.starList[i].drawFunc.width, self.starList[i].drawFunc.height,
                  self.starList[i].width - self.starList[i].scale / 2,
                  self.starList[i].height - self.starList[i].scale / 2,
                  self.starList[i].scale, self.starList[i].scale)
                if (self.starList[i].height > self.canvas.height) {
                  self.starList[i] = Object.assign(self.starList[i], {
                    height: -self.starList[i].scale,
                    width: Math.random() * this.canvas.width
                  })
                }
                self.ctx.restore()
              }
              requestAnimationFrame(loop)
            }
          requestAnimationFrame(loop)
        }
      }
      canvasBgImg.init()
      </script>

    </div>


    <div class="custom-logo-site-title">
      <a href="/" class="brand" rel="start">
        <!-- modify by zhangwei -->
        <!-- 圣诞帽 -->
        <img src="/uploads/santa-hat.png" id="santa" style="height: 41px; position: absolute; left: -40px; top: -20px; transform: rotate(-45deg); z-index: 9000;">

        <span class="logo-line-before"><i></i></span>
        <span class="site-title">班德尔城</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle">微笑，简单，奋发</p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br>
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br>
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/about/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br>
            
            关于
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br>
            
            标签
          </a>
        </li>
      
        
        <li class="menu-item menu-item-guestbook">
          <a href="/guestbook" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-send"></i> <br>
            
            留言
          </a>
        </li>
      
        
        <li class="menu-item menu-item-favourite">
          <a href="/favourite" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-bookmark"></i> <br>
            
            收藏
          </a>
        </li>
      

      
        <li class="menu-item menu-item-search">
          
            <a href="javascript:;" class="popup-trigger">
          
            
              <i class="menu-item-icon fa fa-search fa-fw"></i> <br>
            
            搜索
          </a>
        </li>
      
    </ul>
  

  
    <div class="site-search">
      
  
  <div class="algolia-popup popup search-popup">
    <div class="algolia-search">
      <div class="algolia-search-input-icon">
        <i class="fa fa-search"></i>
      </div>
      <div class="algolia-search-input" id="algolia-search-input"></div>
    </div>

    <div class="algolia-results">
      <div id="algolia-stats"></div>
      <div id="algolia-hits"></div>
      <div id="algolia-pagination" class="algolia-pagination"></div>
    </div>

    <span class="popup-btn-close">
      <i class="fa fa-times-circle"></i>
    </span>
  </div>




    </div>
  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://tiimor.cn/Android青铜篇-layer-list/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="Tiimor">
      <meta itemprop="description" content>
      <meta itemprop="image" content="/uploads/avatar.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="班德尔城">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">Android青铜篇-layer-list</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2017-06-04T14:38:43+08:00">
                2017-06-04
              </time>
            

            

            
          </span>

          
            <span class="post-category">
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/Android联盟/" itemprop="url" rel="index">
                    <span itemprop="name">Android联盟</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
              <span class="post-comments-count">
                <span class="post-meta-divider">|</span>
                <span class="post-meta-item-icon">
                  <i class="fa fa-comment-o"></i>
                </span>
                <a href="/Android青铜篇-layer-list/#comments" itemprop="discussionUrl">
                  <span class="post-comments-count gitment-comments-count" data-xid="/Android青铜篇-layer-list/" itemprop="commentsCount"></span>
                </a>
              </span>
            
          

          
          
             <span id="/Android青铜篇-layer-list/" class="leancloud_visitors" data-flag-title="Android青铜篇-layer-list">
               <span class="post-meta-divider">|</span>
               <!-- modify by zhangwei -->
               <!-- 去掉阅读的眼睛图标，阅读次数改为℃ -->
			   
                 <span class="post-meta-item-text">热度 </span>
               
                 <span class="leancloud-visitors-count"></span>
				 <span>℃</span>
             </span>
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <p><img src="http://cdn.tiimor.cn/images/%E5%94%AF%E7%BE%8E%E7%AF%87%EF%BC%8D%E4%BC%91%E6%81%AF%E5%A5%BD%EF%BC%8C%E6%98%AF%E4%B8%BA%E4%BA%86%E6%98%8E%E5%A4%A9%E6%9B%B4%E5%A5%BD%E7%9A%84%E5%AD%A6%E4%B9%A0.jpg" alt="Android" title="&#x4F11;&#x606F;&#x597D;&#xFF0C;&#x662F;&#x4E3A;&#x4E86;&#x660E;&#x5929;&#x66F4;&#x597D;&#x7684;&#x5B66;&#x4E60;"></p>
<p>layer-list&#x53EF;&#x4EE5;&#x5C06;&#x591A;&#x4E2A;drawable&#x6309;&#x7167;&#x987A;&#x5E8F;&#x5C42;&#x53E0;&#x5728;&#x4E00;&#x8D77;&#x663E;&#x793A;&#xFF0C;&#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;&#x6240;&#x6709;&#x7684;item&#x4E2D;&#x7684;drawable&#x90FD;&#x4F1A;&#x81EA;&#x52A8;&#x6839;&#x636E;&#x5B83;&#x9644;&#x4E0A;view&#x7684;&#x5927;&#x5C0F;&#x800C;&#x8FDB;&#x884C;&#x7F29;&#x653E;&#xFF0C;layer-list&#x4E2D;&#x7684;item&#x662F;&#x6309;&#x7167;&#x987A;&#x5E8F;&#x4ECE;&#x4E0B;&#x5F80;&#x4E0A;&#x53E0;&#x52A0;&#x7684;&#xFF0C;&#x5373;&#x5148;&#x5B9A;&#x4E49;&#x7684;item&#x5728;&#x4E0B;&#x9762;&#xFF0C;&#x540E;&#x9762;&#x7684;&#x4F9D;&#x6B21;&#x5F80;&#x4E0A;&#x9762;&#x53E0;&#x653E;&#x3002;</p>
<a id="more"></a>
<h1 id="&#x7B80;&#x5355;&#x793A;&#x4F8B;"><a href="#&#x7B80;&#x5355;&#x793A;&#x4F8B;" class="headerlink" title="&#x7B80;&#x5355;&#x793A;&#x4F8B;"></a>&#x7B80;&#x5355;&#x793A;&#x4F8B;</h1><ul>
<li><p>Drawable&#xFF0C;layer-list&#x7ED3;&#x5408;shape</p>
<figure class="highlight xml"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;</span>  </span><br><span class="line"><span class="tag">&lt;<span class="name">layer-list</span> <span class="attr">xmlns:android</span>=<span class="string">&quot;http://schemas.android.com/apk/res/android&quot;</span> &gt;</span>  </span><br><span class="line">	  </span><br><span class="line">	<span class="tag">&lt;<span class="name">item</span> &gt;</span>  </span><br><span class="line">		<span class="tag">&lt;<span class="name">shape</span> <span class="attr">android:shape</span>=<span class="string">&quot;rectangle&quot;</span> &gt;</span>  </span><br><span class="line">			<span class="tag">&lt;<span class="name">solid</span> <span class="attr">android:color</span>=<span class="string">&quot;#0000ff&quot;</span>/&gt;</span>  </span><br><span class="line">		<span class="tag">&lt;/<span class="name">shape</span>&gt;</span>  </span><br><span class="line">	<span class="tag">&lt;/<span class="name">item</span>&gt;</span>  </span><br><span class="line">  </span><br><span class="line">	<span class="tag">&lt;<span class="name">item</span> <span class="attr">android:bottom</span>=<span class="string">&quot;25dp&quot;</span> <span class="attr">android:top</span>=<span class="string">&quot;25dp&quot;</span> <span class="attr">android:left</span>=<span class="string">&quot;25dp&quot;</span> <span class="attr">android:right</span>=<span class="string">&quot;25dp&quot;</span>&gt;</span>  </span><br><span class="line">		<span class="tag">&lt;<span class="name">shape</span> <span class="attr">android:shape</span>=<span class="string">&quot;rectangle&quot;</span> &gt;</span>  </span><br><span class="line">			<span class="tag">&lt;<span class="name">solid</span> <span class="attr">android:color</span>=<span class="string">&quot;#00ff00&quot;</span> /&gt;</span>  </span><br><span class="line">		<span class="tag">&lt;/<span class="name">shape</span>&gt;</span>  </span><br><span class="line">	<span class="tag">&lt;/<span class="name">item</span>&gt;</span>  </span><br><span class="line">  </span><br><span class="line">	<span class="tag">&lt;<span class="name">item</span> <span class="attr">android:bottom</span>=<span class="string">&quot;50dp&quot;</span> <span class="attr">android:top</span>=<span class="string">&quot;50dp&quot;</span> <span class="attr">android:left</span>=<span class="string">&quot;50dp&quot;</span> <span class="attr">android:right</span>=<span class="string">&quot;50dp&quot;</span>&gt;</span>  </span><br><span class="line">		<span class="tag">&lt;<span class="name">shape</span> <span class="attr">android:shape</span>=<span class="string">&quot;rectangle&quot;</span> &gt;</span>  </span><br><span class="line">			<span class="tag">&lt;<span class="name">solid</span> <span class="attr">android:color</span>=<span class="string">&quot;#ff0000&quot;</span> /&gt;</span>  </span><br><span class="line">		<span class="tag">&lt;/<span class="name">shape</span>&gt;</span>  </span><br><span class="line">	<span class="tag">&lt;/<span class="name">item</span>&gt;</span>  </span><br><span class="line"><span class="tag">&lt;/<span class="name">layer-list</span>&gt;</span></span><br></pre></td></tr></tbody></table></figure>
</li>
<li><p>&#x5E03;&#x5C40;&#x6587;&#x4EF6;</p>
<figure class="highlight xml"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;</span>  </span><br><span class="line"><span class="tag">&lt;<span class="name">LinearLayout</span> <span class="attr">xmlns:android</span>=<span class="string">&quot;http://schemas.android.com/apk/res/android&quot;</span>  </span></span><br><span class="line"><span class="tag">	<span class="attr">android:layout_width</span>=<span class="string">&quot;match_parent&quot;</span>  </span></span><br><span class="line"><span class="tag">	<span class="attr">android:layout_height</span>=<span class="string">&quot;match_parent&quot;</span>&gt;</span>  </span><br><span class="line">	<span class="tag">&lt;<span class="name">ImageView</span>  </span></span><br><span class="line"><span class="tag">		<span class="attr">android:layout_width</span>=<span class="string">&quot;150dp&quot;</span>  </span></span><br><span class="line"><span class="tag">		<span class="attr">android:layout_height</span>=<span class="string">&quot;150dp&quot;</span>   </span></span><br><span class="line"><span class="tag">		<span class="attr">android:background</span>=<span class="string">&quot;@drawable/layer_list&quot;</span>/&gt;</span>  </span><br><span class="line"><span class="tag">&lt;/<span class="name">LinearLayout</span>&gt;</span></span><br></pre></td></tr></tbody></table></figure>
</li>
<li><p>&#x6548;&#x679C;&#x56FE;<br><img src="http://cdn.tiimor.cn/images/shape-layer-list.png" alt="shape-layer-list"></p>
</li>
</ul>
<p>&#x7EA2;&#x8272;item&#x6700;&#x540E;&#x5B9A;&#x4E49;&#x5728;&#x6700;&#x4E0A;&#x65B9;&#xFF0C;&#x7EFF;&#x8272;item&#x4E2D;&#x95F4;&#xFF0C;&#x6700;&#x5148;&#x5B9A;&#x4E49;&#x84DD;&#x8272;&#x6700;&#x4E0B;&#x8FB9;&#xFF0C;&#x5C5E;&#x6027;&#x8BBE;&#x7F6E;&#x5982;&#xFF1A;<br></p><figure class="highlight vim"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">android:bottom=<span class="string">&quot;50dp&quot;</span>  &#x8868;&#x793A;&#x8BE5;item&#x4E0B;&#x8FB9;&#x4EE5;ImageView&#x4E0B;&#x8FB9;&#x754C;&#x5F80;&#x91CC;&#x9762;&#x7F29;&#x4E86;<span class="number">50</span><span class="keyword">dp</span></span><br><span class="line">android:top=<span class="string">&quot;50dp&quot;</span>  &#x8868;&#x793A;&#x8BE5;item&#x4E0A;&#x8FB9;&#x4EE5;ImageView&#x4E0A;&#x8FB9;&#x754C;&#x5F80;&#x91CC;&#x9762;&#x7F29;&#x4E86;<span class="number">50</span><span class="keyword">dp</span></span><br><span class="line">android:<span class="keyword">left</span>=<span class="string">&quot;50dp&quot;</span>  &#x8868;&#x793A;&#x8BE5;item&#x5DE6;&#x8FB9;&#x4EE5;ImageView&#x5DE6;&#x8FB9;&#x754C;&#x5F80;&#x91CC;&#x9762;&#x7F29;&#x4E86;<span class="number">50</span><span class="keyword">dp</span></span><br><span class="line">android:<span class="keyword">right</span>=<span class="string">&quot;50dp&quot;</span> &#x8868;&#x793A;&#x8BE5;item&#x53F3;&#x8FB9;&#x4EE5;ImageView&#x53F3;&#x8FB9;&#x754C;&#x5F80;&#x91CC;&#x9762;&#x7F29;&#x4E86;<span class="number">50</span><span class="keyword">dp</span></span><br></pre></td></tr></tbody></table></figure><p></p>
<p>&#x5176;&#x4ED6;item&#x7C7B;&#x4F3C;</p>
<h1 id="layer-list&#x5B9E;&#x73B0;&#x4E09;&#x9762;&#x8FB9;&#x6846;"><a href="#layer-list&#x5B9E;&#x73B0;&#x4E09;&#x9762;&#x8FB9;&#x6846;" class="headerlink" title="layer-list&#x5B9E;&#x73B0;&#x4E09;&#x9762;&#x8FB9;&#x6846;"></a>layer-list&#x5B9E;&#x73B0;&#x4E09;&#x9762;&#x8FB9;&#x6846;</h1><ul>
<li><p>Drawable</p>
<figure class="highlight xml"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;</span>  </span><br><span class="line"><span class="tag">&lt;<span class="name">layer-list</span> <span class="attr">xmlns:android</span>=<span class="string">&quot;http://schemas.android.com/apk/res/android&quot;</span> &gt;</span>  </span><br><span class="line">	<span class="tag">&lt;<span class="name">item</span> &gt;</span>  </span><br><span class="line">		<span class="tag">&lt;<span class="name">shape</span> <span class="attr">android:shape</span>=<span class="string">&quot;rectangle&quot;</span> &gt;</span>  </span><br><span class="line">			<span class="tag">&lt;<span class="name">solid</span> <span class="attr">android:color</span>=<span class="string">&quot;#ff0000&quot;</span>/&gt;</span>  </span><br><span class="line">		<span class="tag">&lt;/<span class="name">shape</span>&gt;</span>  </span><br><span class="line">	<span class="tag">&lt;/<span class="name">item</span>&gt;</span>  </span><br><span class="line">  </span><br><span class="line">	<span class="tag">&lt;<span class="name">item</span> <span class="attr">android:bottom</span>=<span class="string">&quot;2dp&quot;</span> <span class="attr">android:top</span>=<span class="string">&quot;2dp&quot;</span>  <span class="attr">android:right</span>=<span class="string">&quot;2dp&quot;</span>&gt;</span>  </span><br><span class="line">		<span class="tag">&lt;<span class="name">shape</span> <span class="attr">android:shape</span>=<span class="string">&quot;rectangle&quot;</span> &gt;</span>  </span><br><span class="line">			<span class="tag">&lt;<span class="name">solid</span> <span class="attr">android:color</span>=<span class="string">&quot;#ffffff&quot;</span> /&gt;</span>  </span><br><span class="line">		<span class="tag">&lt;/<span class="name">shape</span>&gt;</span>  </span><br><span class="line">	<span class="tag">&lt;/<span class="name">item</span>&gt;</span>  </span><br><span class="line"><span class="tag">&lt;/<span class="name">layer-list</span>&gt;</span></span><br></pre></td></tr></tbody></table></figure>
</li>
<li><p>&#x6548;&#x679C;&#x56FE;<br><img src="http://cdn.tiimor.cn/images/layer-list%E4%B8%89%E9%9D%A2%E8%BE%B9%E6%A1%86.png" alt="layer-list&#x4E09;&#x9762;&#x8FB9;&#x6846;"></p>
</li>
</ul>
<h1 id="&#x9634;&#x5F71;&#x6548;&#x679C;"><a href="#&#x9634;&#x5F71;&#x6548;&#x679C;" class="headerlink" title="&#x9634;&#x5F71;&#x6548;&#x679C;"></a>&#x9634;&#x5F71;&#x6548;&#x679C;</h1><p><img src="http://cdn.tiimor.cn/images/layer-list%E9%98%B4%E5%BD%B1.png" alt="layer-list&#x9634;&#x5F71;"></p>
<ul>
<li><p>&#x4F7F;&#x7528;layer-list&#x53EF;&#x4EE5;&#x5C06;&#x591A;&#x4E2A;drawable&#x6309;&#x7167;&#x987A;&#x5E8F;&#x5C42;&#x53E0;&#x5728;&#x4E00;&#x8D77;&#x663E;&#x793A;&#xFF0C;&#x50CF;&#x4E0A;&#x56FE;&#x4E2D;&#x7684;Tab&#xFF0C;&#x662F;&#x7531;&#x4E00;&#x4E2A;&#x7EA2;&#x8272;&#x7684;&#x5C42;&#x52A0;&#x4E00;&#x4E2A;&#x767D;&#x8272;&#x7684;&#x5C42;&#x53E0;&#x5728;&#x4E00;&#x8D77;&#x663E;&#x793A;&#x7684;&#x7ED3;&#x679C;&#xFF0C;&#x9634;&#x5F71;&#x7684;&#x5706;&#x89D2;&#x77E9;&#x5F62;&#x5219;&#x662F;&#x7531;&#x4E00;&#x4E2A;&#x7070;&#x8272;&#x7684;&#x5706;&#x89D2;&#x77E9;&#x5F62;&#x53E0;&#x52A0;&#x4E0A;&#x4E00;&#x4E2A;&#x767D;&#x8272;&#x7684;&#x5706;&#x89D2;&#x77E9;&#x5F62;&#x3002;&#x5148;&#x770B;&#x4E0B;&#x4EE3;&#x7801;&#x5427;&#xFF0C;&#x4EE5;&#x4E0B;&#x662F;Tab&#x80CC;&#x666F;&#x7684;&#x4EE3;&#x7801;&#xFF1A;</p>
<figure class="highlight xml"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;</span>  </span><br><span class="line"><span class="tag">&lt;<span class="name">selector</span> <span class="attr">xmlns:android</span>=<span class="string">&quot;http://schemas.android.com/apk/res/android&quot;</span>&gt;</span>  </span><br><span class="line">	<span class="comment">&lt;!-- &#x7B2C;&#x4E00;&#x79CD;&#x52A0;&#x8F7D;&#x65B9;&#x5F0F; --&gt;</span>  </span><br><span class="line">	<span class="comment">&lt;!--&lt;item android:drawable=&quot;@drawable/bg_tab_selected&quot; android:state_checked=&quot;true&quot; /&gt;--&gt;</span>  </span><br><span class="line">	<span class="comment">&lt;!-- &#x7B2C;&#x4E8C;&#x79CD;&#x52A0;&#x8F7D;&#x65B9;&#x5F0F; --&gt;</span>  </span><br><span class="line">	<span class="tag">&lt;<span class="name">item</span> <span class="attr">android:state_checked</span>=<span class="string">&quot;true&quot;</span>&gt;</span>  </span><br><span class="line">		<span class="tag">&lt;<span class="name">layer-list</span>&gt;</span>  </span><br><span class="line">			<span class="comment">&lt;!-- &#x7EA2;&#x8272;&#x80CC;&#x666F; --&gt;</span>  </span><br><span class="line">			<span class="tag">&lt;<span class="name">item</span>&gt;</span>  </span><br><span class="line">				<span class="tag">&lt;<span class="name">color</span> <span class="attr">android:color</span>=<span class="string">&quot;#E4007F&quot;</span> /&gt;</span>  </span><br><span class="line">			<span class="tag">&lt;/<span class="name">item</span>&gt;</span>  </span><br><span class="line">			<span class="comment">&lt;!-- &#x767D;&#x8272;&#x80CC;&#x666F; --&gt;</span>  </span><br><span class="line">			<span class="tag">&lt;<span class="name">item</span> <span class="attr">android:bottom</span>=<span class="string">&quot;4dp&quot;</span> <span class="attr">android:drawable</span>=<span class="string">&quot;@android:color/white&quot;</span> /&gt;</span>  </span><br><span class="line">		<span class="tag">&lt;/<span class="name">layer-list</span>&gt;</span>  </span><br><span class="line">	<span class="tag">&lt;/<span class="name">item</span>&gt;</span>  </span><br><span class="line">	<span class="tag">&lt;<span class="name">item</span>&gt;</span>  </span><br><span class="line">		<span class="tag">&lt;<span class="name">layer-list</span>&gt;</span>  </span><br><span class="line">			<span class="comment">&lt;!-- &#x7EA2;&#x8272;&#x80CC;&#x666F; --&gt;</span>  </span><br><span class="line">			<span class="tag">&lt;<span class="name">item</span>&gt;</span>  </span><br><span class="line">				<span class="tag">&lt;<span class="name">color</span> <span class="attr">android:color</span>=<span class="string">&quot;#E4007F&quot;</span> /&gt;</span>  </span><br><span class="line">			<span class="tag">&lt;/<span class="name">item</span>&gt;</span>  </span><br><span class="line">			<span class="comment">&lt;!-- &#x767D;&#x8272;&#x80CC;&#x666F; --&gt;</span>  </span><br><span class="line">			<span class="tag">&lt;<span class="name">item</span> <span class="attr">android:bottom</span>=<span class="string">&quot;1dp&quot;</span> <span class="attr">android:drawable</span>=<span class="string">&quot;@android:color/white&quot;</span> /&gt;</span>  </span><br><span class="line">		<span class="tag">&lt;/<span class="name">layer-list</span>&gt;</span>  </span><br><span class="line">	<span class="tag">&lt;/<span class="name">item</span>&gt;</span> </span><br><span class="line"><span class="tag">&lt;/<span class="name">selector</span>&gt;</span></span><br></pre></td></tr></tbody></table></figure>
</li>
<li><p>&#x4EE5;&#x4E0B;&#x662F;&#x5E26;&#x9634;&#x5F71;&#x7684;&#x5706;&#x89D2;&#x77E9;&#x5F62;&#xFF1A;</p>
<figure class="highlight xml"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;</span>  </span><br><span class="line"><span class="tag">&lt;<span class="name">layer-list</span> <span class="attr">xmlns:android</span>=<span class="string">&quot;http://schemas.android.com/apk/res/android&quot;</span>&gt;</span>  </span><br><span class="line">    <span class="comment">&lt;!-- &#x7070;&#x8272;&#x9634;&#x5F71; --&gt;</span>  </span><br><span class="line">    <span class="tag">&lt;<span class="name">item</span>  </span></span><br><span class="line"><span class="tag">        <span class="attr">android:left</span>=<span class="string">&quot;2dp&quot;</span>  </span></span><br><span class="line"><span class="tag">        <span class="attr">android:top</span>=<span class="string">&quot;4dp&quot;</span>&gt;</span>  </span><br><span class="line">        <span class="tag">&lt;<span class="name">shape</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">solid</span> <span class="attr">android:color</span>=<span class="string">&quot;@android:color/darker_gray&quot;</span> /&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">corners</span> <span class="attr">android:radius</span>=<span class="string">&quot;10dp&quot;</span> /&gt;</span>  </span><br><span class="line">        <span class="tag">&lt;/<span class="name">shape</span>&gt;</span>  </span><br><span class="line">    <span class="tag">&lt;/<span class="name">item</span>&gt;</span>  </span><br><span class="line">    <span class="comment">&lt;!-- &#x767D;&#x8272;&#x524D;&#x666F; --&gt;</span>  </span><br><span class="line">    <span class="tag">&lt;<span class="name">item</span>  </span></span><br><span class="line"><span class="tag">        <span class="attr">android:bottom</span>=<span class="string">&quot;4dp&quot;</span>  </span></span><br><span class="line"><span class="tag">        <span class="attr">android:right</span>=<span class="string">&quot;2dp&quot;</span>&gt;</span>  </span><br><span class="line">        <span class="tag">&lt;<span class="name">shape</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">solid</span> <span class="attr">android:color</span>=<span class="string">&quot;#FFFFFF&quot;</span> /&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">corners</span> <span class="attr">android:radius</span>=<span class="string">&quot;10dp&quot;</span> /&gt;</span>  </span><br><span class="line">        <span class="tag">&lt;/<span class="name">shape</span>&gt;</span>  </span><br><span class="line">    <span class="tag">&lt;/<span class="name">item</span>&gt;</span>  </span><br><span class="line"><span class="tag">&lt;/<span class="name">layer-list</span>&gt;</span></span><br></pre></td></tr></tbody></table></figure>
</li>
</ul>
<p>&#x4ECE;&#x4E0A;&#x9762;&#x7684;&#x793A;&#x4F8B;&#x4EE3;&#x7801;&#x53EF;&#x4EE5;&#x770B;&#x5230;&#xFF0C;layer-list&#x53EF;&#x4EE5;&#x4F5C;&#x4E3A;&#x6839;&#x8282;&#x70B9;&#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x4F5C;&#x4E3A;selector&#x4E2D;item&#x7684;&#x5B50;&#x8282;&#x70B9;&#x3002;layer-list&#x53EF;&#x4EE5;&#x6DFB;&#x52A0;&#x591A;&#x4E2A;item&#x5B50;&#x8282;&#x70B9;&#xFF0C;&#x6BCF;&#x4E2A;item&#x5B50;&#x8282;&#x70B9;&#x5BF9;&#x5E94;&#x4E00;&#x4E2A;drawable&#x8D44;&#x6E90;&#xFF0C;&#x6309;&#x7167;item&#x4ECE;&#x4E0A;&#x5230;&#x4E0B;&#x7684;&#x987A;&#x5E8F;&#x53E0;&#x52A0;&#x5728;&#x4E00;&#x8D77;&#xFF0C;&#x518D;&#x901A;&#x8FC7;&#x8BBE;&#x7F6E;&#x6BCF;&#x4E2A;item&#x7684;&#x504F;&#x79FB;&#x91CF;&#x5C31;&#x53EF;&#x4EE5;&#x770B;&#x5230;&#x9634;&#x5F71;&#x7B49;&#x6548;&#x679C;&#x4E86;&#x3002;layer-list&#x7684;item&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x4E0B;&#x9762;&#x56DB;&#x4E2A;&#x5C5E;&#x6027;&#x8BBE;&#x7F6E;&#x504F;&#x79FB;&#x91CF;&#xFF1A;</p>
<blockquote>
<ul>
<li>android:top &#x9876;&#x90E8;&#x7684;&#x504F;&#x79FB;&#x91CF;</li>
<li>android:bottom &#x5E95;&#x90E8;&#x7684;&#x504F;&#x79FB;&#x91CF;</li>
<li>android:left &#x5DE6;&#x8FB9;&#x7684;&#x504F;&#x79FB;&#x91CF;</li>
<li>android:right &#x53F3;&#x8FB9;&#x7684;&#x504F;&#x79FB;&#x91CF;</li>
</ul>
</blockquote>
<p>&#x8FD9;&#x56DB;&#x4E2A;&#x504F;&#x79FB;&#x91CF;&#x548C;&#x63A7;&#x4EF6;&#x7684;margin&#x8BBE;&#x7F6E;&#x5DEE;&#x4E0D;&#x591A;&#xFF0C;&#x90FD;&#x662F;&#x5916;&#x95F4;&#x8DDD;&#x7684;&#x6548;&#x679C;&#x3002;&#x5982;&#x4F55;&#x4E0D;&#x8BBE;&#x7F6E;&#x504F;&#x79FB;&#x91CF;&#xFF0C;&#x524D;&#x9762;&#x7684;&#x56FE;&#x5C42;&#x5C31;&#x5B8C;&#x5168;&#x6321;&#x4F4F;&#x4E86;&#x540E;&#x9762;&#x7684;&#x56FE;&#x5C42;&#xFF0C;&#x4ECE;&#x800C;&#x4E5F;&#x770B;&#x4E0D;&#x5230;&#x540E;&#x9762;&#x7684;&#x56FE;&#x5C42;&#x6548;&#x679C;&#x4E86;&#x3002;&#x6BD4;&#x5982;&#x4E0A;&#x9762;&#x7684;&#x4F8B;&#x5B50;&#xFF0C;Tab&#x80CC;&#x666F;&#x4E2D;&#x7684;&#x767D;&#x8272;&#x80CC;&#x666F;&#x8BBE;&#x7F6E;&#x4E86;android:bottom&#x4E4B;&#x540E;&#x624D;&#x80FD;&#x770B;&#x5230;&#x4E00;&#x70B9;&#x7EA2;&#x8272;&#x80CC;&#x666F;&#x3002;&#x90A3;&#x4E48;&#x5982;&#x679C;&#x504F;&#x79FB;&#x91CF;&#x8BBE;&#x4E3A;&#x8D1F;&#x503C;&#x4F1A;&#x600E;&#x4E48;&#x6837;&#x5462;&#xFF1F;&#x7ECF;&#x8FC7;&#x9A8C;&#x8BC1;&#xFF0C;&#x504F;&#x79FB;&#x8D85;&#x51FA;&#x7684;&#x90E8;&#x5206;&#x4F1A;&#x88AB;&#x622A;&#x6389;&#x800C;&#x770B;&#x4E0D;&#x5230;&#xFF0C;&#x4E0D;&#x4FE1;&#x53EF;&#x4EE5;&#x81EA;&#x5DF1;&#x8BD5;&#x4E00;&#x4E0B;&#x3002;&#x6709;&#x65F6;&#x5019;&#x8FD9;&#x5F88;&#x6709;&#x7528;&#xFF0C;&#x6BD4;&#x5982;&#x5F53;&#x6211;&#x60F3;&#x663E;&#x793A;&#x4E00;&#x4E2A;&#x534A;&#x5706;&#x7684;&#x65F6;&#x5019;&#x3002;<br>&#x53E6;&#x5916;&#xFF0C;&#x5173;&#x4E8E;item&#x7684;&#x7528;&#x6CD5;&#xFF0C;&#x4E5F;&#x505A;&#x4E0B;&#x603B;&#x7ED3;&#xFF1A;<br><strong>1.</strong> &#x6839;&#x8282;&#x70B9;&#x4E0D;&#x540C;&#x65F6;&#xFF0C;&#x53EF;&#x8BBE;&#x7F6E;&#x7684;&#x5C5E;&#x6027;&#x662F;&#x4F1A;&#x4E0D;&#x540C;&#x7684;&#xFF0C;&#x6BD4;&#x5982;selector&#x4E0B;&#xFF0C;&#x53EF;&#x4EE5;&#x8BBE;&#x7F6E;&#x4E00;&#x4E9B;&#x72B6;&#x6001;&#x5C5E;&#x6027;&#xFF0C;&#x800C;&#x5728;layer-list&#x4E0B;&#xFF0C;&#x53EF;&#x4EE5;&#x8BBE;&#x7F6E;&#x504F;&#x79FB;&#x91CF;&#xFF1B;<br><strong>2.</strong> &#x5C31;&#x7B97;&#x7236;&#x8282;&#x70B9;&#x540C;&#x6837;&#x662F;selector&#xFF0C;&#x653E;&#x5728;drawable&#x76EE;&#x5F55;&#x548C;&#x653E;&#x5728;color&#x76EE;&#x5F55;&#x4E0B;&#x53EF;&#x7528;&#x7684;&#x5C5E;&#x6027;&#x4E5F;&#x4F1A;&#x4E0D;&#x540C;&#xFF0C;&#x6BD4;&#x5982;drawable&#x76EE;&#x5F55;&#x4E0B;&#x53EF;&#x7528;&#x7684;&#x5C5E;&#x6027;&#x4E3A;android:drawable&#xFF0C;&#x5728;color&#x76EE;&#x5F55;&#x4E0B;&#x53EF;&#x7528;&#x7684;&#x5C5E;&#x6027;&#x4E3A;android:color&#xFF1B;<br><strong>3.</strong> item&#x7684;&#x5B50;&#x8282;&#x70B9;&#x53EF;&#x4EE5;&#x4E3A;&#x4EFB;&#x4F55;&#x7C7B;&#x578B;&#x7684;drawable&#x7C7B;&#x6807;&#x7B7E;&#xFF0C;&#x9664;&#x4E86;&#x4E0A;&#x9762;&#x4F8B;&#x5B50;&#x4E2D;&#x7684;shape&#x3001;color&#x3001;layer-list&#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x662F;selector&#xFF0C;&#x8FD8;&#x6709;&#x5176;&#x4ED6;&#x6CA1;&#x8BB2;&#x8FC7;&#x7684;bitmap&#x3001;clip&#x3001;scale&#x3001;inset&#x3001;transition&#x3001;rotate&#x3001;animated-rotate&#x3001;lever-list&#x7B49;&#x7B49;&#x3002;</p>
<script>
        document.querySelectorAll('.github-emoji')
          .forEach(el => {
            if (!el.dataset.src) { return; }
            const img = document.createElement('img');
            img.style = 'display:none !important;';
            img.src = el.dataset.src;
            img.addEventListener('error', () => {
              img.remove();
              el.style.color = 'inherit';
              el.style.backgroundImage = 'none';
              el.style.background = 'none';
            });
            img.addEventListener('load', () => {
              img.remove();
            });
            document.body.appendChild(img);
          });
      </script>
      
    </div>
    
    
    

    

    
      <div>
        <div style="padding: 10px 0; margin: 20px auto; width: 90%; text-align: center;">
  <div>谢谢老板，请尽情用红包来蹂躏我吧！！！</div>
  <button id="rewardButton" disable="enable" onclick="var qr = document.getElementById('QR'); if (qr.style.display === 'none') {qr.style.display='block';} else {qr.style.display='none'}">
    <span>赏</span>
  </button>
  <div id="QR" style="display: none;">

    
      <div id="wechat" style="display: inline-block">
        <img id="wechat_qr" src="/uploads/wechatpay.jpg" alt="Tiimor 微信打赏">
        <p>微信打赏</p>
      </div>
    

    
      <div id="alipay" style="display: inline-block">
        <img id="alipay_qr" src="/uploads/alipay.jpg" alt="Tiimor 支付宝打赏">
        <p>支付宝打赏</p>
      </div>
    

    

  </div>
</div>

      </div>
    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <!-- modify by zhangwei -->
            <!-- 文章底部标签图标 -->
            <a href="/tags/Android/" rel="tag"><i class="menu-item-icon fa fa-tag fa-fw"></i>Android</a>
          
            <!-- modify by zhangwei -->
            <!-- 文章底部标签图标 -->
            <a href="/tags/layer-list/" rel="tag"><i class="menu-item-icon fa fa-tag fa-fw"></i>layer-list</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/Android青铜篇-XMLDrawable/" rel="next" title="Android青铜篇-XMLDrawable">
                <i class="fa fa-chevron-left"></i> Android青铜篇-XMLDrawable
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/Android青铜篇-selector/" rel="prev" title="Android青铜篇-selector">
                Android青铜篇-selector <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          

  
    <div class="comments" id="comments">
      
        <div id="gitment-container"></div>
      
    </div>

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image" src="/uploads/avatar.jpg" alt="Tiimor">
            
              <p class="site-author-name" itemprop="name">Tiimor</p>
              <p class="site-description motion-element" itemprop="description">安静地做一只攻城狮。</p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="/archives/">
              
                  <span class="site-state-item-count">41</span>
                  <span class="site-state-item-name">日志</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-categories">
                <a href="/categories/index.html">
                  <span class="site-state-item-count">6</span>
                  <span class="site-state-item-name">分类</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-tags">
                <a href="/tags/index.html">
                  <span class="site-state-item-count">56</span>
                  <span class="site-state-item-name">标签</span>
                </a>
              </div>
            

          </nav>

          
            <div class="feed-link motion-element">
              <a href="/atom.xml" rel="alternate">
                <i class="fa fa-rss"></i>
                RSS
              </a>
            </div>
          

          
            <div class="links-of-author motion-element">
                
                  <span class="links-of-author-item">
                    <a href="https://github.com/VeiZhang" target="_blank" title="GitHub">
                      
                        <i class="fa fa-fw fa-github"></i>GitHub</a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="http://www.weibo.com/tiimor" target="_blank" title="微博">
                      
                        <i class="fa fa-fw fa-weibo"></i>微博</a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="https://juejin.im/user/589972d0570c3500624fd791" target="_blank" title="掘金">
                      
                        <i class="fa fa-fw fa-anchor"></i>掘金</a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="http://www.jianshu.com/u/93b886580243" target="_blank" title="简书">
                      
                        <i class="fa fa-fw fa-book"></i>简书</a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="http://wpa.qq.com/msgrd?v=3&uin=690393541&site=qq&menu=yes" target="_blank" title="QQ">
                      
                        <i class="fa fa-fw fa-qq"></i>QQ</a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="mailto:tiimor@qq.com" target="_blank" title="邮箱">
                      
                        <i class="fa fa-fw fa-envelope"></i>邮箱</a>
                  </span>
                
            </div>
          

          
          

          
          

          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#简单示例"><span class="nav-number">1.</span> <span class="nav-text">简单示例</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#layer-list实现三面边框"><span class="nav-number">2.</span> <span class="nav-text">layer-list实现三面边框</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#阴影效果"><span class="nav-number">3.</span> <span class="nav-text">阴影效果</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; 2017 &mdash; <span itemprop="copyrightYear">2019</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Tiimor</span>

  
</div>


  <div class="powered-by">由 <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a> 强力驱动</div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">主题 &mdash; <a class="theme-link" target="_blank" href="https://github.com/iissnan/hexo-theme-next">NexT.Pisces</a></div>




        
<div class="busuanzi-count">
  <!-- modify by zhangwei -->
  <!-- 修改不蒜子统计脚本 -->
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>

  
    <span class="site-uv">
      <i class="fa fa-user"></i>
      <span class="busuanzi-value" id="busuanzi_value_site_uv"></span>
      
    </span>
  

  
    <span class="site-pv">
      <i class="fa fa-eye"></i>
      <span class="busuanzi-value" id="busuanzi_value_site_pv"></span>
      
    </span>
  
</div>



<script>
  	var _mtac = {};
  	(function() {
  		var mta = document.createElement("script");
  		mta.src = "https://pingjs.qq.com/h5/stats.js?v2.0.4";
  		mta.setAttribute("name", "MTAH5");
  		mta.setAttribute("sid", "500425805");

  		var s = document.getElementsByTagName("script")[0];
  		s.parentNode.insertBefore(mta, s);
  	})();
</script>


  <script type="text/javascript">
    (function() {
      var hm = document.createElement("script");
      hm.src = "//tajs.qq.com/stats?sId=61441764";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>




        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
          <span id="scrollpercent"><span>0</span>%</span>
        
      </div>
    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  


  











  
  
    <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
  

  
  
    <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
  

  
  
    <script type="text/javascript" src="/lib/canvas-nest/canvas-nest.min.js"></script>
  


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.4"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.4"></script>



  
  


  <script type="text/javascript" src="/js/src/affix.js?v=5.1.4"></script>

  <script type="text/javascript" src="/js/src/schemes/pisces.js?v=5.1.4"></script>



  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.4"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.4"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.4"></script>



  


  




	





  





  







<!-- LOCAL: You can save these files to your site and update links -->
    
        
        <link rel="stylesheet" href="https://aimingoo.github.io/gitmint/style/default.css">
        <script src="https://aimingoo.github.io/gitmint/dist/gitmint.browser.js"></script>
    
<!-- END LOCAL -->

    

    
      <script type="text/javascript">
      function renderGitment(){
        var gitment = new Gitmint({
            <!-- modify by zhangwei -->
            <!-- 修复gitment评论页初始化错误@tiimor -->
            id: '1496558323000', 
            owner: 'VeiZhang',
            repo: 'veizhang.github.io',
            
            lang: "" || navigator.language || navigator.systemLanguage || navigator.userLanguage,
            
            oauth: {
            
            
                client_secret: '9919bc61413a89ea3eb156910d282e3103093e32',
            
                client_id: 'f08924ca58e61d6f51f4'
            }});
        gitment.render('gitment-container');
      }

      
      renderGitment();
      
      </script>
    







  




  
  
  
  <link rel="stylesheet" href="/lib/algolia-instant-search/instantsearch.min.css">

  
  
  <script src="/lib/algolia-instant-search/instantsearch.min.js"></script>
  

  <script src="/js/src/algolia-search.js?v=5.1.4"></script>



  

  
  <script src="https://cdn1.lncld.net/static/js/av-core-mini-0.6.4.js"></script>
  <script>AV.initialize("7aBs9I9Y3PjoN6ueX5J3AYQW-gzGzoHsz", "kboycyzaPNAYcUW8AkF3edeW");</script>
  <script>
    function showTime(Counter) {
      var query = new AV.Query(Counter);
      var entries = [];
      var $visitors = $(".leancloud_visitors");

      $visitors.each(function () {
        entries.push( $(this).attr("id").trim() );
      });

      query.containedIn('url', entries);
      query.find()
        .done(function (results) {
          var COUNT_CONTAINER_REF = '.leancloud-visitors-count';

          if (results.length === 0) {
            $visitors.find(COUNT_CONTAINER_REF).text(0);
            return;
          }

          for (var i = 0; i < results.length; i++) {
            var item = results[i];
            var url = item.get('url');
            var time = item.get('time');
            var element = document.getElementById(url);

            $(element).find(COUNT_CONTAINER_REF).text(time);
          }
          for(var i = 0; i < entries.length; i++) {
            var url = entries[i];
            var element = document.getElementById(url);
            var countSpan = $(element).find(COUNT_CONTAINER_REF);
            if( countSpan.text() == '') {
              countSpan.text(0);
            }
          }
        })
        .fail(function (object, error) {
          console.log("Error: " + error.code + " " + error.message);
        });
    }

    function addCount(Counter) {
      var $visitors = $(".leancloud_visitors");
      var url = $visitors.attr('id').trim();
      var title = $visitors.attr('data-flag-title').trim();
      var query = new AV.Query(Counter);

      query.equalTo("url", url);
      query.find({
        success: function(results) {
          if (results.length > 0) {
            var counter = results[0];
            counter.fetchWhenSave(true);
            counter.increment("time");
            counter.save(null, {
              success: function(counter) {
                var $element = $(document.getElementById(url));
                $element.find('.leancloud-visitors-count').text(counter.get('time'));
              },
              error: function(counter, error) {
                console.log('Failed to save Visitor num, with error message: ' + error.message);
              }
            });
          } else {
            var newcounter = new Counter();
            /* Set ACL */
            var acl = new AV.ACL();
            acl.setPublicReadAccess(true);
            acl.setPublicWriteAccess(true);
            newcounter.setACL(acl);
            /* End Set ACL */
            newcounter.set("title", title);
            newcounter.set("url", url);
            newcounter.set("time", 1);
            newcounter.save(null, {
              success: function(newcounter) {
                var $element = $(document.getElementById(url));
                $element.find('.leancloud-visitors-count').text(newcounter.get('time'));
              },
              error: function(newcounter, error) {
                console.log('Failed to create');
              }
            });
          }
        },
        error: function(error) {
          console.log('Error:' + error.code + " " + error.message);
        }
      });
    }

    $(function() {
      var Counter = AV.Object.extend("Counter");
      if ($('.leancloud_visitors').length == 1) {
        addCount(Counter);
      } else if ($('.post-title-link').length > 1) {
        showTime(Counter);
      }
    });
  </script>



  

  
<script>
(function(){
    var bp = document.createElement('script');
    var curProtocol = window.location.protocol.split(':')[0];
    if (curProtocol === 'https') {
        bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';        
    }
    else {
        bp.src = 'http://push.zhanzhang.baidu.com/push.js';
    }
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(bp, s);
})();
</script>


  
  

  

  

  

  
  <!-- modify by zhangwei -->
  <!-- 动态时间小人 -->
  <!-- modify by zhangwei -->
<!-- 动态时间小人 -->
<!-- z-index -1 表示在最底层，不能悬浮也不能点击 -->
<!-- z-index auto 可以点击 -->
<!-- z-index 9999 无限大时，总是在最上层，会影响其他悬浮框 -->
<div id="dg" style="z-index: auto; position: fixed ! important; right: 0px; top: 0px;">  
    <table width 100% style="position: absolute; width:260px; right: 0px; top: 0px;">  
		<div>
			<embed wmode="transparent" src="http://cdn.tiimor.cn/images/dynamic_time.swf" quality="high" bgcolor="#ffffff" width="160" height="70" name="honehoneclock" align="middle" allowscriptaccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">
		</div>
    </table>  
</div>
  
</body>
</html>
